<template>
  <div class="sub-title-box">
    <div class="back" @click="backStorePage">
      <i class="iconfont icon-left" />
      <span>返回</span>
    </div>
    <h2 class="title">{{ title }}</h2>
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
const router = useRouter();

const title = ref('')
onMounted(() => {
  const route = useRoute();
  title.value = route.meta.title;
});
// 回到对应主页
const backStorePage = () => {
  router.push('/mall/store')
};
</script>

<style scoped lang="scss">
.sub-title-box {
  position: absolute;
  width: 100%;
  text-align: center;
  background-color: #fff;
  top: 0;
  left: 0;
  padding: 2vmin 2vmax;

  .title {
    font-weight: bold;
  }

  .back {
    position: absolute;
    height: 5vmin;
    line-height: 5vmin;
    color: rgb(39, 53, 86, 0.6);
    cursor: pointer;

    span {
      font-weight: bold;
      margin-left: 10px;
    }
  }
}
</style>